package com.xiaoshuidi.cloud.module.finance.api.finance;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.finance.api.finance.dto.BankTransferReqDTO;
import com.xiaoshuidi.cloud.module.finance.api.finance.dto.CarryForwardDTO;
import com.xiaoshuidi.cloud.module.finance.api.finance.dto.CheckPayResultReqDTO;
import com.xiaoshuidi.cloud.module.finance.api.finance.dto.FinanceMoneyFlowDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Tag(name = "RPC 服务 - 财务")
@FeignClient(name = "lease-finance-server")
public interface FinanceApi {
    /**
     * 账单费用结转
     *
     * @param sourceBizType 来源业务类型 {@link com.xiaoshuidi.cloud.module.finance.enums.finance.SourceBizTypeEnum}
     * @param reqDTO        需要结转的账单及金额
     * @return
     */
    @PostMapping("/rpc-api/finance/carry-forward")
    @Operation(summary = "账单费用结转流水")
    CommonResult<Void> carryForward(@RequestParam("sourceBizType") String sourceBizType,
                                    @Valid @RequestBody @NotNull(message = "结转数据不能为空")
                                    @Size(min = 1) List<CarryForwardDTO> reqDTO);

    /**
     * 账单费用实际支付流水
     * 线上
     *
     * @param sourceBizType 来源业务类型 {@link com.xiaoshuidi.cloud.module.finance.enums.finance.SourceBizTypeEnum}
     * @param reqDTO        需要结转的账单及金额
     * @return
     */
    @PostMapping("/rpc-api/finance/money-flow/list")
    @Operation(summary = "账单费用实际支付流水")
    CommonResult<List<FinanceMoneyFlowDTO>> moneyFlowList(@RequestParam("sourceBizType") String sourceBizType,
                                                          @Valid @RequestBody @NotNull(message = "关联数据不能为空")
                                                          @Size(min = 1) List<CarryForwardDTO> reqDTO);

    @PostMapping("/rpc-api/finance/bank/transfer")
    @Operation(summary = "银企直连付款")
    CommonResult<Void> bankTransfer(@Valid @RequestBody BankTransferReqDTO reqDTO);

    @PostMapping("/rpc-api/finance/bank/transfer/batch")
    @Operation(summary = "银企直连批量付款")
    CommonResult<Void> bankTransferBatch(@Valid @RequestBody List<BankTransferReqDTO> reqDTO);

    @PostMapping("/rpc-api/finance/check-pay-result")
    @Operation(summary = "检查支付状态")
    CommonResult<Map<String, BigDecimal>> checkPayResult(@RequestBody CheckPayResultReqDTO reqDTO);
}
